package netframe;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import beans.ActionInfoBean;
import beans.AllDepts;
import beans.AllEmployee;
import beans.CabinetInfoBean;
import beans.CardinalNumberModifyBean;
import beans.CheckHospitalBean;
import beans.CheckSureBean;
import beans.ComboBean;
import beans.ComboInfoBean;
import beans.GoodsDetailsBean;
import beans.GoodsInfoBean;
import beans.GoodsReturnBean;
import beans.GoodsStatisticsBean;
import beans.HospitalDepartBean;
import beans.HospitalGoodsInfo;
import beans.HospitalNameBean;
import beans.InitCabinetNumberBean;
import beans.InitCabinetNumberParam;
import beans.LoginBean;
import beans.OperateGoodsDetailsBean;
import beans.OperateLogDetailsBean;
import beans.PostBean;
import beans.PutAndDeleteBean;
import beans.PutCardinalNumberBean;
import beans.PutComboBean;
import beans.PutComboResultBean;
import beans.ResponeSupplierRightsBean;
import beans.ResultSupplierRightsBean;
import beans.RoleInfoBean;
import beans.Role_ActionBean;
import beans.StorageWarningBean;
import beans.SupplierRightsBean;
import beans.TerminalBean;
import beans.TerminalEnableBean;
import beans.TokenBean;
import beans.LogBean;
import beans.NewUserInfoBean;
import beans.UnusedGoodsBean;
import beans.UserInfoBean;
import beans.WarningInfoBean;
import beans.XLKJResult;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by admin on 2017/5/23.
 */
public interface NetInterface {

    //retrofit请求的参数配置
    //项目
//    @GET("Attest")
//    Call<TokenBean> getToken();

    //获取GoodsDetails
    @FormUrlEncoded
    @POST("GoodsDetails/GetInRfId")
    Call<ArrayList<GoodsDetailsBean>> getGoodsDetails(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Field("sql") String sql);

    @GET("GoodsDetails")
    Call<ArrayList<GoodsDetailsBean>> getGoodsDetailsPage(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //获取GoodsInfo
    @GET("GoodsInfo")
    Call<ArrayList<GoodsInfoBean>> getGoodsInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //获取GoodsInfo
    @FormUrlEncoded
    @POST("GoodsInfo/PostGoodsInfo")
    Call<ArrayList<GoodsInfoBean>> getGoodsInfo1(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("sql") String sql);

    //修改用户表
    @PUT("UserInfo/PutExecSql")
    Call<PutAndDeleteBean> putUserInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //修改用户表
    @FormUrlEncoded
    @POST("UserInfo/UpdateUserInfo")
    Call<PutAndDeleteBean> postUserInfo(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("sql") String sql);


    @PUT("UserInfo/PutExecSql")
    Call<PutAndDeleteBean> deleteUserInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    @GET("GoodsReturn")
    Call<ArrayList<GoodsReturnBean>> getGoodsReturn(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    @GET("UserInfo")
    Call<ArrayList<UserInfoBean>> getUserInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    //getUserInfo的url路径过长时，使用此接口（短的，用上面的接口）
    @FormUrlEncoded
    @PUT("UserInfo/GetUserInfo")
    Observable<NewUserInfoBean> getUserInfo2(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("sql") String sql);

    @FormUrlEncoded
    @PUT("UserInfo/GetUserInfo")
    Call<NewUserInfoBean> getUserInfo3(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("sql") String sql);

    @POST("UserInfo/PostEntity")
    Call<PostBean> postUserInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body UserInfoBean newUserInfoBean);

    @GET("RoleInfo")
    Call<ArrayList<RoleInfoBean>> getRoleInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    @GET("Role_Action")
    Call<ArrayList<Role_ActionBean>> getRoleActionId(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    @GET("ActionInfo")
    Call<ArrayList<ActionInfoBean>> getActionInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    @GET("CabinetInfo")
    Observable<ArrayList<CabinetInfoBean>> getCabinetInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);


    //以下为新的接口

    //获取物资信息(不会生成日志)
    @FormUrlEncoded
    @POST("GoodsDetails/GetGoodsInfo")
    Observable<OperateGoodsDetailsBean> getGoodDetails(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("RfidList") List<String> RfidList,
            @Field("TerminalInfoID") String TerminalInfoID,
            @Field("LogicNumber") String LogicNumber,
            @Field("Type") String Type);

    //获取物资信息(不会生成日志)
    @FormUrlEncoded
    @POST("GoodsDetails/GetGoodsInfoTerm")
    Observable<OperateGoodsDetailsBean> getGoodDetailsInventory(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("RfidList") List<String> RfidList,
            @Field("TerminalInfoID") String TerminalInfoID,
            @Field("LogicNumber") String LogicNumber,
            @Field("Type") String Type,
            @Field("Userid") String Userid,
            @Field("DeptCode") String DeptCode);

    //获取物资信息(会生成日志),适用于取出,放入等需要计入日志的操作
    @FormUrlEncoded
    @POST("GoodsDetails/OperateGoods")
    Observable<OperateGoodsDetailsBean> operateGoodDetails(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("RfidList") List<String> RfidList,
            @Field("TerminalInfoID") String TerminalInfoID,
            @Field("LogicNumber") String LogicNumber,
            @Field("Userid") int Userid,
            @Field("Type") int Type);

    //非正常开门时,生成日志的接口
    @FormUrlEncoded
    @POST("GoodsDetails/OperateEmergency")
    Observable<OperateGoodsDetailsBean> operateEmergencyGoodDetails(
            @Field("tokenCode") String tokenCode,
            @Field("machineCode") String machineCode,
            @Field("RfidList") List<String> RfidList,
            @Field("CabinetInfoId") String cabinetCode,
            @Field("Type") int Type);

    //初始化柜子(即柜子编码)
    @POST("CabinetInfo/SetCabinetNumber")
    Observable<InitCabinetNumberBean> initCabinetNumber(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body List<InitCabinetNumberParam> list);

    //终端激活
    @FormUrlEncoded
    @POST("TerminalInfo/SetTerminal")
    Observable<TerminalEnableBean> terminalEnable(
            @FieldMap Map<String, String> map);

    @GET("TerminalInfo")
    Call<ArrayList<TerminalBean>> getDeptCode(
            @Query("sql") String sql);

    //查询MachineCode是否激活过
    @GET("Token")
    Observable<List<TokenBean>> getToken(
            @Query("sql") String sql);

    @GET("Token")
    Call<List<TokenBean>> getToken1(
            @Query("sql") String sql);

    //得到CabinetInfoId
    @GET("CabinetInfo")
    Call<ArrayList<CabinetInfoBean>> getCabinetInfoId1(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //得到CabinetInfoId
    @GET("CabinetInfo")
    Observable<List<CabinetInfoBean>> getCabinetInfoId(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //得到医疗厂家可以使用的CabinetInfoId
    @GET("SupplierRights")
    Observable<List<SupplierRightsBean>> getSupplierRights(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //更改医药厂家权限的接口
    @POST("SupplierRights/SetSupplierRights")
    Observable<ResponeSupplierRightsBean> setSupplierRights(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body ResultSupplierRightsBean bean);

    //统计页面的接口
    @GET("GoodsDetails/GetGoodsStatistics")
    Observable<GoodsStatisticsBean> getGoodsStatistics(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @QueryMap Map<String, String> map);

    @GET("GoodsDetails/GetGoodsStatistics")
    Call<GoodsStatisticsBean> getGoodsStatistics1(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @QueryMap Map<String, String> map);

    //日志页面的接口
    @GET("OperateLog/GetOperateLog")
    Observable<LogBean> getLogs(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @QueryMap Map<String, String> map);

    //日志页面的接口
    @GET("LogDetails/GetLogDetails")
    Observable<List<OperateLogDetailsBean>> getLogDetail(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("logId") String logId);

    //获取GoodsInfo
    @GET("GoodsInfo")
    Observable<ArrayList<GoodsInfoBean>> getGoodsInfos(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //医院的接口
    //获取科室
    @GET("GetDeparment")
    Observable<List<HospitalDepartBean>> getHospitalDepartment(
            @Query("deparmentName") String deparmentName);

    //获取科室
    @GET("GetStaffInfo")
    Observable<List<HospitalNameBean>> getHospitalName(
                    @Query("staffCode") String staffCode);

    //验收的接口
//    @GET("ExecI_MATERIAL_HIGHT_PRE_DEPT")
//    Observable<JsonArray> checkToHospital(@Query("codeList") List<CheckSureBean> codeList);

    @POST("ExecI_MATERIAL_HIGHT_PRE_DEPT")
    Observable<List<CheckHospitalBean>> checkToHospital(
            @Body List<CheckSureBean> codeList);

    @POST("getAllDepts")
    Observable<XLKJResult<AllDepts>> getDept();


    @POST("getEmployeeByYgdm")
    Observable<XLKJResult<AllEmployee>> getHospitalUserInfo(@Query("ygdm") String ygdm);

    @GET("StorageWarning")
    Call<List<StorageWarningBean>> getStorageWarning(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    //修改预警表`
    @PUT("StorageWarning/PutExecSql")
    Call<PutAndDeleteBean> putStorageWarningInfo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("sql") String sql);

    @GET("GoodsDetails/GetWarningGoodsInfo")
    Call<WarningInfoBean> getWarningGoods(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("departmentCode") String departmentCode);

    @POST("StorageWarning/PostEntityList")
    Call<PutAndDeleteBean> postStorageWarning(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body List<StorageWarningBean> storageWarningBeans);

    @GET("GoodsStatistics/GetUnusedGoods")
    Call<UnusedGoodsBean> getUnusedGoods(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("departmentCode") String departmentCode,
            @Query("userId") String userId,
            @Query("condition") String condition);

    @FormUrlEncoded
    @POST("StorageWarning/GetStorage")
    Call<List<StorageWarningBean>> getStorageWarning1(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Field("sql") String sql);

    @GET("GoodsDetails/GetWarningGoodsInfos")
    Call<WarningInfoBean> getInventortWarn(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("department") String department);

    @GET("GetGoodsInfo")
    Call<List<HospitalGoodsInfo>> selectToHospital(
            @Query("data") String data,
            @Query("type") int type);

    /**
     *  登录成功 ，获取 近效提醒、库存预警、未归提示的数量
     * @param tokenCode
     * @param machineCode
     * @param userId
     * @param departmentCode
     * @return
     */

    @GET("LoginCount/GetLoginCount")
    Call<LoginBean> getLoginData(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("userId") String userId,
            @Query("departmentCode") String departmentCode
    );

    /**
     *  获取柜子物品 返回值有基数
     * @param tokenCode
     * @param machineCode
     * @param departmentCode
     * @return
     */

    @GET("GoodsDetails/GetGoodsStock")
    Call<WarningInfoBean> getCaidinalNumberGoods(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("departmentCode") String departmentCode);

    /**
     *  获取柜子物品 返回值有基数 （包括之前柜中有，后来用完的物品）
     * @param tokenCode
     * @param machineCode
     * @param departmentCode
     * @return
     */

    @GET("GoodsDetails/GetCardinalNumbeGoods")
    Call<WarningInfoBean> getCaidinalNumberAllGoods(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("departmentCode") String departmentCode);


    /**
     *  修改物品基数
     * @param tokenCode
     * @param machineCode
     * @param list
     * @return
     */

    @POST("GoodsDetails/SetCardinalNumber")
    Call<CardinalNumberModifyBean> setCardinalNumber(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body List<PutCardinalNumberBean> list);

    /**
     *  获取所有套餐
     * @param tokenCode
     * @param machineCode
     * @param comboName  传空查全部
     * @return
     */

    @GET("GoodsPackage/GetGoodsPackage")
    Call<ComboBean> getComboData(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("packageName") String comboName);

    /**
     *  套餐详情
     * @param tokenCode
     * @param machineCode
     * @param goodsPackageId  套餐ID
     * @return
     */

    @GET("GoodsPackage/GetPackageDetails")
    Call<ComboInfoBean> getComboInfoData(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("goodsPackageId") String goodsPackageId);

    /**
     *  新增、修改套餐
     * @param tokenCode
     * @param machineCode
     * @param putComboBean
     * @return
     */
    @POST("GoodsPackage/IntoGoodsPackage")
    Call<PutComboResultBean> putCombo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Body PutComboBean putComboBean);

    /**
     *  删除套餐
     * @param tokenCode
     * @param machineCode
     * @param goodsPackageId  套餐ID
     * @return
     */

    @GET("GoodsPackage/DeleteGoodsPackage")
    Call<ComboBean> deleteCombo(
            @Query("tokenCode") String tokenCode,
            @Query("machineCode") String machineCode,
            @Query("goodsPackageId") String goodsPackageId);

}
